{% extends "base_general.html" %}

{% block title %}{{ consorcio.nombre }} - Listado de departamentos {% endblock title %}

{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.ingrid-0.9.2.js"></script>
<script type="text/javascript" src="/static/js/jquery.jeditable.pack.js"></script>
<link rel="stylesheet" href="/static/js/ingrid.css" type="text/css" media="screen" />
{% endblock %}


{% block jquery %}
<script type="text/javascript">


$(document).ready(
     
	function() {
		
		
		$("#deptos").ingrid({ 
			//url: '/balance/detalle-{{ balance.id }}',
			//initialLoad: false,			
			height: {{ alto }},
			colWidths: [30,35,35,100,150],		// width of each column
			rowClasses: ['grid-row-style1','grid-row-style2'],
			resizableCols: false,
			paging: false,
			rowSelection: false,
			sorting: false
		});
       
        
		$(".edit-coeficiente").editable("/depto/ajax/coeficiente", {
						event     : "dblclick"
		});						
        
        $(".edit-gasto_fijo").editable("/depto/ajax/gasto_fijo", {
        						event     : "dblclick"
        		});	        
        
        $(".edit-consorcista").editable("/depto/ajax/consorcista", {
        						event     : "dblclick"
        		});						        
        
	}
); 
</script>

{% endblock jquery%}


{% block left %}
<h2>{{ consorcio.nombre }} - Listado de departamentos</h2>
<p>Doble click en un campo para modificar</p>


<table id="deptos">
<thead>
<tr><th></th><th>Piso</th><th>Ala</th>

{% ifequal consorcio.tipo_expensa 2 %}
{#expensa variable #}
<th>Coeficiente</th>
{% else %}
<th>Expensa mensual</th>
{% endifequal %}

<th>Consorcista</th></tr>
</thead>
<tbody>
{% for depto in deptos %}
                         <tr>
                        <td style="font-size:0.6em"><a href="./depto{{ depto.piso }}-{{ depto.ala }}/" title="ver historial del depto">V</a> <a href="./deptos/{{ depto.id }}/delete" title="eliminar el depto {{ depto }}">X</a> <a href="./depto{{ depto.piso }}-{{ depto.ala }}/detalles" title="editar el depto {{ depto }}">M</a></td>
                         <td style="text-align:right">{% ifequal depto.piso 0 %}PB {% else %}{{ depto.piso }}{% endifequal %}</td>
                         <td style="text-align:right">{{ depto.ala }}</td>
                         <td style="text-align:right">

                        {% ifequal consorcio.tipo_expensa 2 %}
                        {#expensa variable #}
                        <div class="edit-coeficiente" id="{{ depto.id }}">{{ depto.coeficiente }}</div>
                        {% else %}
                        $ <span class="edit-gasto_fijo" id="{{ depto.id }}">{{ depto.gasto_fijo }}</span>
                        {% endifequal %}                        
                        
                        
                         <td><div class="edit-consorcista" id="{{ depto.id }}">{{ depto.nombre_consorcista }}</td>
                         </tr>
{% endfor %}               
</tbody>
</table>


<h2>Agregar Depto</h2>
<form action="./deptos" method="POST">
{{ form_nuevo_depto.as_p }}
<input type="submit" value="agregar al consorcio" />
</form>




{% endblock %}

{% block nav %}
<ul id="nav">
<li><a href="/consorcio/{{ consorcio.id }}">Ir al consorcio</a></li>
</ul>
{% endblock %}

{% block box %}{% endblock %}